package com.andnnl.controller.demo;

import com.andnnl.api.demo.DemoService;
import org.apache.dubbo.config.annotation.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by chenss on 2019/8/16.
 */
@Controller
public class DemoController {
    private static final Logger logger = LoggerFactory.getLogger(DemoController.class);

    //但是version一定要指定 不然会找不到服务 直连需要加url="dubbo://localhost:12345"，端口号和配置文件中保持一致
    @Reference(version = "1.0.0")
    private DemoService demoService;

    @RequestMapping("/hello")
    @ResponseBody
    public String sayHello(){
        System.out.println("******demo-consumer被访问******");
        String x = demoService.sayHello("ddddddd");
        System.out.println(x);
        return x;
    }

}
